package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.MarketStorage;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.service.admin.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/wx/storage")
public class WxStorageController {
    @Autowired
    StorageService storageService;

    @RequestMapping("/upload")
    public BaseRespVo create(@RequestParam("file") MultipartFile multipartFile) throws IOException {
        MarketStorage marketStorage = storageService.fileUpload(multipartFile);
        BaseRespVo ok = BaseRespVo.ok(marketStorage);
        return ok;
    }
}
